using System;
using System.Data;
using System.Web;
namespace HKB.Common
{
	public class Config
	{
		public string InstallDir = "";
		public string AppPrefix = "";
		private DataRow _config = null;
		private DataTable _config_Table = null;
		protected DataTable configdata
		{
			get
			{
				string text = this.AppPrefix + "HoWaveSiteConfig";
				DataTable result;
				if (HttpContext.Current.Cache[text] == null)
				{
					string path = HttpContext.Current.Server.MapPath("~/") + this.InstallDir + "App_Data/SiteConfig.config";
					XmlHelper xmlHelper = new XmlHelper();
					DataSet dataSet = xmlHelper.GetDataSet(path);
					DataTable dataTable = dataSet.Tables[0];
					DataTable table = dataSet.Tables["TemplateSetList"];
					dataTable.Merge(table);
					DataCache.SetCacheDepFile(text, dataTable, DataCache.siteconfigfile);
					result = dataTable;
				}
				else
				{
					result = (DataTable)HttpContext.Current.Cache[text];
				}
				return result;
			}
		}
		public DataRow config
		{
			get
			{
				DataRow config;
				if (this._config == null)
				{
					this._config = this.configdata.Rows[0];
					config = this._config;
				}
				else
				{
					config = this._config;
				}
				return config;
			}
		}
		public DataTable config_Table
		{
			get
			{
				DataTable config_Table;
				if (this._config_Table == null)
				{
					this._config_Table = this.configdata;
					config_Table = this._config_Table;
				}
				else
				{
					config_Table = this._config_Table;
				}
				return config_Table;
			}
		}
		public Config()
		{
			this.InstallDir = AppSetings.Get("InstallDir");
			this.AppPrefix = AppSetings.Get("AppPrefix");
		}
	}
}
